/**
 * Created by midori on 2015/12/9.
 */
(function() {
    var PartialsService, module;

    PartialsService = (function() {
        function PartialsService(RestAngularHandlerFactory, Restangular, $http) {
            this.RestAngularHandlerFactory = RestAngularHandlerFactory;
            this.Restangular = Restangular;
            this.$http = $http;
        }

        PartialsService.prototype._partialsCache = {};

        PartialsService.prototype.getPartial = function(partialName) {
            if (this._partialsCache[partialName] == null) {
                this._partialsCache[partialName] = this.$http.get(partialName);
            }
            return this._partialsCache[partialName];
        };

        return PartialsService;

    })();

    module = angular.module("services.PartialsService", ["restangular", "services.utils.RestAngularHandler"]);

    module.factory('PartialsService', [
        "RestAngularHandlerFactory", "Restangular", "$http", function(RestAngularHandlerFactory, Restangular, $http) {
            return new PartialsService(RestAngularHandlerFactory, Restangular, $http);
        }
    ]);

}).call(this);
